package org.uim.cricket.storage.queries;

public class CountryQueryGenerator extends QueryGenerator {

	private String team = null;
	private String continent;
	private String abbr;
	private boolean associated;
	
	public CountryQueryGenerator(String name, String continent, String abbr, boolean associated) {
		super(null);
		
		this.team = name;
		this.continent = continent;
		this.abbr = abbr;
		this.associated = associated;
	}
	
	@Override
	public String generateQuery() throws Exception {
		StringBuilder query = new StringBuilder("CALL sp_Insert_Country(");
		this.appendQuery(query, encodeSQL(this.team), 128, false);
		this.appendQuery(query, encodeSQL(this.abbr), 8, false);
		query.append(associated).append(",");
		this.appendQuery(query, encodeSQL(this.continent), 128, false, false);

		query.append(");\n");
		return query.toString();
	}

}
